package com.demo.cotroller;

import com.demo.bean.Student;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by wangzhanjin on 2018/6/8.
 * log4j定义了8个级别的log（除去OFF和ALL，可以说分为6个级别），优先级从高到低依次为：OFF、FATAL、ERROR、WARN、INFO、DEBUG、TRACE、 ALL
 */
@Controller
@Slf4j
public class HomeController {

    @RequestMapping("/log")
    @ResponseBody
    public String hello() {
        log.error("log日志，级别：error");
        log.warn("log日志，级别：warn");
        log.info("log日志，级别：info");
        log.debug("log日志，级别：debug");
        log.trace("log日志，级别：trace");
        log.info("日志{}，格式{}","参数1","参数2");
        Student student = new Student();
        student.setName("所谓伊人");
        System.out.println("咋回事呢");
        return "黄河之水天上来" + student.toString();
    }
}
